package SortDemo;

/**
 * Created by yexuan on 2018/3/27.
 */
public class BubbleSortDemo {
    public static void main(String[] args){

        for (int i :method(new int[]{3,5,6,1,2})){
            System.out.println(i);
        }
    }

    public static int[] method(int[] ints){
        for (int i=0;i < ints.length;i++){
            for (int j = 0; j< ints.length-i-1;j++){
                int temp = 0;
                if(ints[i]>ints[i+1]){
                    temp = ints[i];
                    ints[i] = ints[i+1];
                    ints[i+1] = temp;
                }
            }
        }
        return ints;
    }
}
